package greedy.跳跃游戏II;

public class Solution {
    public int jump(int[] nums) {
        int ans = 0;
        int len = nums.length - 1;
        int end = len;
        while(end != 0 ){
            for (int i = 0 ; i < end ; i++) {
                if (end - (nums[i] + i) <= 0){
                    ans++;
                    end = i ;
                    break;
                }
            }
        }
        return ans;
    }

    public static void main(String[] args) {
//        [7,0,9,6,9,6,1,7,9,0,1,2,9,0,3]
        System.out.println(new Solution().jump(new int[]{1,2,3}));

    }
}
